﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace iMKelly {
    public partial class frmMain : Form {
        enum myEnum { Admin, Reader };
        CoreClass.Database dbs;
        public frmMain(CoreClass.Database dbs) {
            this.dbs = dbs;
            InitializeComponent();
            if (dbs == null) {
                toolStrip1.Enabled = false;
                String path = Microsoft.VisualBasic.Interaction.InputBox("Input Database Path", "Option");
                Properties.Settings.Default.Path = path;
                Properties.Settings.Default.Save();
            }
        }

        private void toolStripButton1_Click(object sender, EventArgs e) {
            frmUserManagement user = new frmUserManagement(dbs);
            user.MdiParent = this;
            user.Show();
        }

        private void toolStripButton2_Click(object sender, EventArgs e) {
            frmBookManagement book = new frmBookManagement(dbs);
            book.MdiParent = this;
            book.Show();
        }

        private void toolStripButton4_Click(object sender, EventArgs e) {
            frmLending lent = new frmLending(dbs);
            lent.MdiParent = this;
            lent.Show();
        }

        private void toolStripButton5_Click(object sender, EventArgs e) {
            frmReturing returning = new frmReturing(dbs);
            returning.MdiParent = this;
            returning.Show();
        }

        private void toolStripButton3_Click(object sender, EventArgs e) {

        }

        private void frmMain_Deactivate(object sender, EventArgs e) {
            Application.ExitThread();
        }
    }
}
